//
//  GraphTipView.m
//  MonitoringNetwork
//
//  Created by admin on 2018/1/17.
//  Copyright © 2018年 wtmcxlm. All rights reserved.
//

#import "GraphTipView.h"
#import "NSString+StringSize.h"

@interface GraphTipView()
@property (nonatomic,strong)UILabel *dateTitleLabel;
@property (nonatomic,strong)UILabel *dateLabel;
@property (nonatomic,strong)UILabel *detaliLabel;
@property (nonatomic,strong)UILabel *detaliTitleLabel;
@end

@implementation GraphTipView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor grayColor];
        [self setUpUI];
    }
    return self;
}

- (void)setUpUI
{
   _detaliTitleLabel = [UILabel LabelWithFont:MinFontSize andColor:[UIColor whiteColor] andTextAlignment:left andString:@"车辆上线数"];
    [self addSubview:_detaliTitleLabel];
    [_detaliTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.mas_left).offset(5);
        make.centerY.mas_equalTo(self.mas_top).offset(50*0.25);
    }];
    
    _detaliLabel = [UILabel LabelWithFont:MinFontSize andColor:[UIColor whiteColor] andTextAlignment:left andString:@""];
    [self addSubview:_detaliLabel];
    [_detaliLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(_detaliTitleLabel.mas_right).offset(5);
        make.centerY.mas_equalTo(self.mas_top).offset(50*0.25);
    }];
    
    _dateTitleLabel = [UILabel LabelWithFont:MinFontSize andColor:[UIColor whiteColor] andTextAlignment:left andString:@"日期"];
    [self addSubview:_dateTitleLabel];
    [_dateTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self).offset(5);
        make.centerY.mas_equalTo(self.mas_top).offset(50*0.75);
    }];
    
    _dateLabel = [UILabel LabelWithFont:MinFontSize andColor:[UIColor whiteColor] andTextAlignment:left andString:@""];
    [self addSubview:_dateLabel];
    [_dateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(_dateTitleLabel.mas_right).offset(5);
        make.centerY.mas_equalTo(self.mas_top).offset(50*0.75);
    }];
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    _detaliTitleLabel.text = _titleStr1;
    _dateLabel.text = _numStr2;
    _dateTitleLabel.text = _titleStr2;
    _detaliLabel.text = _detailStr;
    _detaliTitleLabel.text = _titleStr1;
}


- (void)setTitleStr1:(NSString *)titleStr1
{
    _titleStr1 = titleStr1;
//    _detaliTitleLabel.text = _titleStr1;
//    _dateLabel.text = _numStr2;
//    _dateTitleLabel.text = _titleStr2;
//    _detaliLabel.text = _detailStr;
//    _detaliTitleLabel.text = _titleStr1;
//
//    [_detaliTitleLabel mas_updateConstraints:^(MASConstraintMaker *make) {
//        make.left.mas_equalTo(self.mas_left).offset(5);
//        make.centerY.mas_equalTo(self.mas_top).offset(50*0.25);
//        make.width.mas_equalTo(size.width);
//    }];
//    [_detaliLabel mas_updateConstraints:^(MASConstraintMaker *make) {
//        make.left.mas_equalTo(self.mas_left).offset(5+size.width);
//        make.centerY.mas_equalTo(self.mas_top).offset(50*0.25);
//    }];
//
//    [_dateTitleLabel mas_updateConstraints:^(MASConstraintMaker *make) {
//        make.left.mas_equalTo(self.mas_left).offset(5);
//        make.centerY.mas_equalTo(self.mas_top).offset(50*0.75);
//    }];
//    [_dateLabel mas_updateConstraints:^(MASConstraintMaker *make) {
//        make.left.mas_equalTo(_dateTitleLabel.mas_left).offset(5);
//        make.centerY.mas_equalTo(self.mas_top).offset(50*0.75);
//    }];
}

@end
